<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
      function myNew(constructor,...args)
      {
         const newObj = Object.create(constructor.prototype);
         const result = constructor.apply(newObj,...args);
         return (result!==null&&typeof result=="object")?result:newObj;
      }

      function Person()
      {
        this.name = "cq";
        this.age = 10
      }

      let person = myNew(Person);
      console.log(person);
    </script>
</body>
</html>